home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / PCI.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  6KB  |  167 lines

  1. /*
  2.      File:        PCI.h
  3.  
  4.      Contains:    PCI Bus Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __PCI__
  19. #define __PCI__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __NAMEREGISTRY__
  25. #include <NameRegistry.h>
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #if PRAGMA_IMPORT_SUPPORTED
  33. #pragma import on
  34. #endif
  35.  
  36. #if PRAGMA_ALIGN_SUPPORTED
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  41. /* Types and structures for accessing the PCI Assigned-Address property.*/
  42. #define kPCIAssignedAddressProperty "assigned-addresses"
  43.  
  44. enum {
  45.     kPCIRelocatableSpace        = 0x80,
  46.     kPCIPrefetchableSpace        = 0x40,
  47.     kPCIAliasedSpace            = 0x20,
  48.     kPCIAddressTypeCodeMask        = 0x03,
  49.     kPCIConfigSpace                = 0,
  50.     kPCIIOSpace                    = 1,
  51.     kPCI32BitMemorySpace        = 2,
  52.     kPCI64BitMemorySpace        = 3
  53. };
  54.  
  55. typedef UInt8 PCIAddressSpaceFlags;
  56.  
  57. enum {
  58.     kPCIDeviceNumberMask        = 0x1F,
  59.     kPCIFunctionNumberMask        = 0x07
  60. };
  61.  
  62. typedef UInt8 PCIDeviceFunction;
  63. typedef UInt8 PCIBusNumber;
  64. typedef UInt8 PCIRegisterNumber;
  65. struct PCIAssignedAddress {
  66.     PCIAddressSpaceFlags             addressSpaceFlags;
  67.     PCIBusNumber                     busNumber;
  68.     PCIDeviceFunction                 deviceFunctionNumber;
  69.     PCIRegisterNumber                 registerNumber;
  70.     UnsignedWide                     address;
  71.     UnsignedWide                     size;
  72. };
  73. typedef struct PCIAssignedAddress PCIAssignedAddress;
  74.  
  75. typedef PCIAssignedAddress *PCIAssignedAddressPtr;
  76. #define GetPCIIsRelocatable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
  77. #define GetPCIIsPrefetchable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
  78. #define GetPCIIsAliased( AssignedAddressPtr )            ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
  79. #define GetPCIAddressSpaceType( AssignedAddressPtr )    ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
  80. #define GetPCIBusNumber( AssignedAddressPtr )            ((AssignedAddressPtr)->busNumber)
  81. #define GetPCIDeviceNumber( AssignedAddressPtr )        (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
  82. #define GetPCIFunctionNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
  83. #define GetPCIRegisterNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->registerNumber)
  84.  
  85. #if GENERATING68K && !GENERATINGCFM
  86. #pragma parameter __D0 EndianSwap16Bit(__D0)
  87. #endif
  88. extern pascal UInt16 EndianSwap16Bit(UInt16 data16)
  89.  ONEWORDINLINE(0xE158);
  90.  
  91.  
  92. #if GENERATING68K && !GENERATINGCFM
  93. #pragma parameter __D0 EndianSwap32Bit(__D0)
  94. #endif
  95. extern pascal UInt32 EndianSwap32Bit(UInt32 data32)
  96.  THREEWORDINLINE(0xE158, 0x4840, 0xE158);
  97.  
  98. #endif
  99. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  100. extern pascal OSErr ExpMgrConfigReadByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 *valuePtr)
  101.  THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
  102.  
  103. extern pascal OSErr ExpMgrConfigReadWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 *valuePtr)
  104.  THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
  105.  
  106. extern pascal OSErr ExpMgrConfigReadLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 *valuePtr)
  107.  THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
  108.  
  109. extern pascal OSErr ExpMgrConfigWriteByte(RegEntryIDPtr node, LogicalAddress configAddr, UInt8 value)
  110.  THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
  111.  
  112. extern pascal OSErr ExpMgrConfigWriteWord(RegEntryIDPtr node, LogicalAddress configAddr, UInt16 value)
  113.  THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
  114.  
  115. extern pascal OSErr ExpMgrConfigWriteLong(RegEntryIDPtr node, LogicalAddress configAddr, UInt32 value)
  116.  THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
  117.  
  118. extern pascal OSErr ExpMgrIOReadByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 *valuePtr)
  119.  THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
  120.  
  121. extern pascal OSErr ExpMgrIOReadWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 *valuePtr)
  122.  THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
  123.  
  124. extern pascal OSErr ExpMgrIOReadLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 *valuePtr)
  125.  THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
  126.  
  127. extern pascal OSErr ExpMgrIOWriteByte(RegEntryIDPtr node, LogicalAddress ioAddr, UInt8 value)
  128.  THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
  129.  
  130. extern pascal OSErr ExpMgrIOWriteWord(RegEntryIDPtr node, LogicalAddress ioAddr, UInt16 value)
  131.  THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
  132.  
  133. extern pascal OSErr ExpMgrIOWriteLong(RegEntryIDPtr node, LogicalAddress ioAddr, UInt32 value)
  134.  THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
  135.  
  136. extern pascal OSErr ExpMgrInterruptAcknowledgeReadByte(RegEntryIDPtr entry, UInt8 *valuePtr)
  137.  THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
  138.  
  139. extern pascal OSErr ExpMgrInterruptAcknowledgeReadWord(RegEntryIDPtr entry, UInt16 *valuePtr)
  140.  THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
  141.  
  142. extern pascal OSErr ExpMgrInterruptAcknowledgeReadLong(RegEntryIDPtr entry, UInt32 *valuePtr)
  143.  THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
  144.  
  145. extern pascal OSErr ExpMgrSpecialCycleWriteLong(RegEntryIDPtr entry, UInt32 value)
  146.  THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
  147.  
  148. extern pascal OSErr ExpMgrSpecialCycleBroadcastLong(UInt32 value)
  149.  THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
  150.  
  151. #endif
  152.  
  153. #if PRAGMA_ALIGN_SUPPORTED
  154. #pragma options align=reset
  155. #endif
  156.  
  157. #if PRAGMA_IMPORT_SUPPORTED
  158. #pragma import off
  159. #endif
  160.  
  161. #ifdef __cplusplus
  162. }
  163. #endif
  164.  
  165. #endif /* __PCI__ */
  166.  
  167.